<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:82:"D:\wwwroot\fangcms_city_add\public/../application/mobile\view\question\detail.html";i:1493711366;s:80:"D:\wwwroot\fangcms_city_add\public/../application/mobile\view\public\layout.html";i:1493803137;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title><?php echo $seo['title']; ?></title>
    <meta name="Keywords" content="<?php echo $seo['keys']; ?>">
    <meta name="Description" content="<?php echo $seo['desc']; ?>">
    <link rel="stylesheet" href="__CSS__/amazeui.min.css"/>
    <link type="text/css" rel="stylesheet"  href="__CSS__/main.css"/>
    <link rel="stylesheet" href="__CSS__/mobile.css">
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script>
        var page = 1,flag  = true,params =  {page: page};
    </script>
</head>
<body>

<header data-am-widget="header" class="am-header am-header-default">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back();" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <?php if(isset($info)): ?><?php echo $info['title']; else: ?><?php echo $title; endif; ?>
    </h1>
    <div class="am-header-right am-header-nav">
        <a href="<?php echo url('Index/index'); ?>" class="">
            <i class="am-header-icon am-icon-home"></i>
        </a>
    </div>
</header>


<div>
    <div class="position"><p>您的当前位置：<a href="<?php echo url('Index/index'); ?>">首页</a>  >  <a href="<?php echo url('Question/index'); ?>">问答</a>
    </p>
    </div>
    <div class="div_box">
        <div class="ask_show01_n1">
            <h1><?php echo $info['title']; ?></h1>
            <p><span class="more"><?php echo date('Y-m-d H:i:s',$info['create_time']); ?></span>提问者：<?php echo $info['user_name']; ?> 浏览 <?php echo $info['hits']; ?> 次</p>
            <div><?php echo $info['content']; ?></div>
        </div>
        <div class="ask_show01_n2">
            <input type="hidden" id="ask_id" value="<?php echo $info['id']; ?>">
            <p><textarea class="inp09" name="textarea" id="answer_content" placeholder="请输入您的回答..." style="width: 99%" rows="5"></textarea></p>
            <p><a id="answerBut" href="javascript:;" data-uri="<?php echo url('Ajax/answer'); ?>" class="but03">提交回答</a></p>
        </div>
    </div>

    <div class="div_box">
        <h1 class="h1_title"><span class="h1_title_t">网友回答</span></h1>
        <?php if(is_array($moreAnswer) || $moreAnswer instanceof \think\Collection || $moreAnswer instanceof \think\Paginator): $i = 0; $__LIST__ = $moreAnswer;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
        <div class="ask_show03 overflow_h">
            <span class="ask_main_img"><a href="javascript:;"><img src="<?php echo $vo['user']['headimgurl']; ?>"></a></span>
            <dl>
                <dt><span class="ask_show03_t_s1"><?php echo date('Y-m-d H:i',$vo['create_time']); ?></span>回答者：<span class="org04"><a href="javascript:;"><?php echo $vo['user']['nickname']; ?></a></span> </dt>
                <dd><?php echo $vo['content']; ?></dd>
                <dd><p data-bid="<?php echo $vo['id']; ?>" data-uri="<?php echo url('Ajax/fabulous'); ?>"><span data-boxtype="top" data-type="good" class="ask_show03_t_s2"><?php echo $vo['good']; ?></span><span data-boxtype="step" data-type="bad" class="ask_show03_t_s3"><?php echo $vo['bad']; ?></span></p></dd>
            </dl>
        </div>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        <div class="plastic_bottom_pages">
            <?php echo $pages; ?>
        </div>
    </div>

    <div class="div_box">
        <h1 class="h1_title"><span class="h1_title_t">相关问答</span><span class="more"><a href="<?php echo url('Question/index',['cate_id'=>$info['cate_id']]); ?>">更多 ></a></span></h1>
        <div class="houses_inf">
            <ul>
                <?php $cate_id=$info['cate_id'];$cityid=$cityInfo['id']; $obj = model("ask");$obj->where("status=1 and city=$cityid and cate_id=$cate_id");$obj->field("id,title");$obj->order("id desc");$name = $obj->limit(5)->select();if(is_array( $name ) || $name  instanceof \think\Paginator): $i = 0; $__LIST__ = $name;if( count($__LIST__)==0 ) : echo "暂无数据" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <li><a title="<?php echo $vo['title']; ?>" href="<?php echo url('Question/detail',['id'=>$vo['id']]); ?>"><?php echo $vo['title']; ?></a></li>
                <?php endforeach; endif; else: echo "暂无数据" ;endif; ?>
            </ul>
        </div>
    </div>
</div>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script src="__PUBLIC__/js/plugins/jquery.ajax.form.js"></script>
<script>
    $(function(){
        $('.ask_show03_t_s2,.ask_show03_t_s3').bind('click',function(){
            var type = $(this).data('type'),me=$(this),id=$(this).parent().data('bid'),url=$(this).parent().data('uri');
            var param = {id:id,type:type};
            $.post(url,param,function(res){
                if(res.status == 1){
                    layer.msg(res.msg,{icon:1});
                    me.text(parseInt(me.text())+1);
                }else{
                    layer.msg(res.msg,{icon:2});
                }
            });
        });
        $('#answerBut').bind('click',function(){
            var ask_id = $('#ask_id').val(),content=$('#answer_content').val(),url=$(this).data('uri');
            if($.trim(content).length==0){
                layer.msg('请填写答案后再提交');
            }else{
                var param = {ask_id:ask_id,content:content};
                $.post(url,param, function (res) {
                    if(res.status == 1){
                        layer.msg(res.msg,{icon:1});
                        setTimeout(function(){window.location.href=location.href+'?t='+Math.random();},2000);
                    }else{
                        layer.msg(res.msg,{icon:2});
                    }
                })
            }
        });

    });
</script>

<footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
    <div class="am-footer-switch"><?php $n=0; if(is_array($menu) || $menu instanceof \think\Collection || $menu instanceof \think\Paginator): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;if($vo['pos'] == 2): $n++; if(!(empty($vo['alias']) || (($vo['alias'] instanceof \think\Collection || $vo['alias'] instanceof \think\Paginator ) && $vo['alias']->isEmpty()))): $url=url($vo['model'].'/detail',['cate'=>$vo['alias']]); else: $url=url($vo['model'].'/index'); endif; if($n > 1): ?><span class="am-footer-divider"> | </span><?php endif; ?><a class="am-footer-desktop" href="<?php echo $url; ?>"><?php echo $vo['title']; ?></a>
        <?php endif; endforeach; endif; else: echo "" ;endif; ?>

    </div>
    <div class="am-footer-miscs ">

        <p>&copy;<?php echo date('Y'); ?>版权所有 <?php echo $site['title']; ?></p>
        <p>客服电话：<?php echo $site['telphone']; ?></p>
    </div>
    <div class="fang-footer-bar">
        <ul class="am-avg-sm-4">
            <li><a href="<?php echo url('Index/index'); ?>" <?php if($controller == "index"): ?>class="on"<?php endif; ?>><i class="am-icon-home am-icon-sm"></i><p>首页</p></a></li>
            <li><a href="<?php echo url('Loupan/index'); ?>" <?php if($controller == "loupan"): ?>class="on"<?php endif; ?>><i class="am-icon-building am-icon-sm"></i><p>新房</p></a></li>
            <li><a href="<?php echo url('Second/index'); ?>" <?php if($controller == "second"): ?>class="on"<?php endif; ?>><i class="am-icon-institution am-icon-sm"></i><p>二手</p></a></li>
            <li><a href="<?php echo url('user.index/index'); ?>"><i class="am-icon-user am-icon-sm"></i><p>我的</p></a></li>
        </ul>
    </div>
</footer>
<?php echo $site['mobileJs']; if(isset($ajaxdata)): ?>
<div id="loadingToast" class="am-hide">
    <div class="ylj-mask"></div>
    <div class="ylj-toast">
        <i class="ylj-loading weui-icon_toast"></i>
        <p class="ylj-toast__content">数据加载中</p>
    </div>
</div>
<script src="__PUBLIC__/js/layer/laytpl.js"></script>
<script>
    $(function(){
        $(window).scroll(function(){
            if(($(window).scrollTop() + $(window).height() > $(document).height()-10) && flag){
                var totalpage = $("#lists").data('total');
                if(totalpage > 1 && totalpage >= page){
                    $("#loadingToast").removeClass('am-hide');
                    getData();
                }else{
                    $("#loading-alt").removeClass('am-hide');
                    flag = false;
                }
            }
        });
    });
    function getData(){
        var url =  $("#lists").data('uri');
        $.get(url,params,function(data){
            $("#loadingToast").addClass('am-hide');
            if(data.status == 1){
                if(data.data){
                    var gettpl = document.getElementById('template').innerHTML;
                    laytpl(gettpl).render(data.data, function(html){
                        $('#lists').append(html);
                    });
                }else{
                    $('#lists').html('<li>暂无数据</li>');
                }

            }else{
                $("#loading-alt").removeClass('am-hide');
                flag = false;
            }
        });
        page++;
    }
</script>
<?php endif; ?>
</body>
</html>